package com.example.demo.service;

import com.alibaba.fastjson.JSON;
import com.example.demo.dto.Card;

import java.util.*;

public class BaseCardService {

    /**
     * 基本牌类型
     */
    private static final Set<String> BASE_CARD_TYPES = new HashSet<>();

    /**
     * 基本花色：黑桃（Spade）、红桃（Heart）、方块（Diamond）、梅花（Club）
     */
    private static final Set<String> CARD_COLOR = new HashSet<>();

    /**
     * 所有卡牌
     */
    private static final List<Card> TOTAL_CARD_LIST = new ArrayList<>();

    /**
     * 王牌
     */
    private static final List<String> KING_LIST = new ArrayList<>(2);

    static  {
        KING_LIST.addAll(Arrays.asList("bigKing", "smallKing"));
        BASE_CARD_TYPES.addAll(Arrays.asList("2", "A", "K", "Q", "J"));

        for (Integer i = 10; i >= 3; i--) {
            BASE_CARD_TYPES.add(i.toString());
        }

        System.out.println("基础牌类:" + JSON.toJSONString(BASE_CARD_TYPES));


        CARD_COLOR.addAll(Arrays.asList("S", "H", "D", "C"));

        for (String cardType : BASE_CARD_TYPES) {
            for (String color: CARD_COLOR) {
                TOTAL_CARD_LIST.add(new Card(cardType, color));
            }
        }
    }
}
